<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <base href="<%=basePath%>">
    <title>打卡记录</title>
    <script src="<%=basePath%>plug_in/js/jquery-1.11.1.min.js"></script>
    <%--引入时间控件--%>
    <script language="javascript" type="text/javascript"
            src="<%=basePath%>plug_in/My97DatePicker/WdatePicker.js"></script>


</head>
<body>

<div style="">
    <a href="<%=basePath%>api/lg" style="float: right;font-weight: bolder;border: 2px solid blue;">退出</a><br/>

    <form action="<%=basePath%>api/tj/wk" method="post">
        <div>
            <c:if test="${sessionScope.flag=='admin'}">

                <span  style="width: 80px;padding-left: 10px;" > 姓名：</span>
                <input id="searchuser" name="searchuser" value="${searchUser}" style="width: 80px;" />
                <select id="chooseuser">
                    <option></option>
                    <c:forEach items="${sessionScope.users}" var="user">
                        <option
                                <c:if test="${searchUser==user}">selected</c:if> value="${user}">${user}</option>
                    </c:forEach>
                </select>

            </c:if>

            <span  style="width: 80px;padding-left: 10px;" >选择时间：</span>
            <input name="searchdate" style="width: 80px;"
                        title="修改时间"
                        value="${year}-${month}"
                        id="searchdate"
                        onclick="WdatePicker({dateFmt:'yyyy-MM',readOnly:true})"/> &nbsp; &nbsp; &nbsp;
            <button type="submit">查询</button>
            <%--<c:if test="${sessionScope.flag=='admin'}">--%>
                <%--&nbsp; &nbsp; &nbsp;--%>
                <%--<button type="button" onclick="kqtb()">考勤同步</button>--%>
            <%--</c:if>--%>
        </div>
    </form>

    <table border="1" width="95%">
        <tr align="center" style="background-color: lightskyblue;">
            <td width="20%">人员</td>
            <td width="20%">日期</td>
            <td width="30%">上午</td>
            <td width="30%">下午</td>
        </tr>
        <c:forEach items="${list}" var="dk">
            <tr align="center"
                <c:if test="${dk.zm=='1'}">style="background-color: #FF6600;"</c:if>  >
                <td>${dk.user}</td>
                <td>${dk.date}</td>
                <td
                        <c:if test="${dk.chiDao=='1' && dk.zm!='1'}">style="color: red;font-weight: bolder;" </c:if> >
                        ${dk.startTime}
                    <c:if test="${dk.dkf=='1' && dk.zm!='1' }">未打卡</c:if>
                </td>

                <td
                        <c:if test="${dk.zaoTui=='1' && dk.zm!='1'}">style="color: red;font-weight: bolder;" </c:if> >
                        ${dk.endTime}
                    <c:if test="${dk.dkf=='1'&& dk.zm!='1' }">未打卡</c:if>
                </td>


            </tr>
        </c:forEach>
    </table>

</div>

</body>

<script type="text/javascript">
    function kqtb() {
        location.href = "<%=basePath%>api/tj/kqtb";
    }

    $(function () {
        $("#chooseuser").on("change", function () {
            var chooseuser = $("#chooseuser").val();
            if (chooseuser && chooseuser != "") {
                $("#searchuser").val(chooseuser);
            }
        });

    })

</script>
</html>
